package br.gov.capgov.treinamento.jpa.entidades;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Transient;

@Entity
@NamedQuery(name="Sistema.findAll", query="SELECT q FROM Sistema q")
public class Sistema implements Serializable
{
	private static final long serialVersionUID = 1L;

	@Id 
	@SequenceGenerator(name="SISTEMA_ID_GENERATOR", sequenceName="SISTEMA_ID_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SISTEMA_ID_GENERATOR") 
	private Integer id;
	
	@Column(name="nome_sistema") //, unique=true)
	private String nomeSistema;
	
	@Column(name="verificar") 
	private boolean verificar=true;
	
	@Column(name="disponivel") 
	private boolean disponivel;
	
	@OneToMany(mappedBy="sistema",  cascade = CascadeType.REMOVE)
	List <Url> urls1;
	
	@Transient
	List <Url> urls;
	
	public Sistema()
	{	
	}
	
	@Override
    public String toString() {
        return nomeSistema;
    }

	public Integer getId()
	{
		return id;
	}
	public void setId(Integer id)
	{
		this.id = id;
	}
	public String getNomeSistema()
	{
		return nomeSistema;
	   }  
	public void setNomeSistema(String nomeSistema)
	{
		this.nomeSistema = nomeSistema;
	}
	public boolean isVerificar()
	{
		return verificar;
	}
	public void setVerificar(boolean verificar)
	{
		this.verificar = verificar;
	}
	public boolean isDisponivel()
	{
		return disponivel;
	}
	public void setDisponivel(boolean disponivel)
	{
		this.disponivel = disponivel;
	}	
	public List<Url> getUrls()
	{
		return urls;
	}
	public void setUrls(List<Url> urls)
	{
		this.urls = urls;
	}		
}